package day02.双指针;

public class 移动零 {
    public void moveZeroes(int[] nums) {
        int n = nums.length;
        for (int left = -1, right = 0; right < n; right++) {
            if (nums[right] != 0) {
                left++;
                int tmp = nums[left];
                nums[left] = nums[right];
                nums[right] = tmp;
            }
        }
    }
}
